#!/usr/bin/env bash
if [ ! -d /Workspace ]
then
    mkdir /Workspace
fi

cd /Workspace

if [ ! -f /Workspace/mysql-5.1.56.tar.gz ]
then
    wget http://mysql.phphosts.org/Downloads/MySQL-5.1/mysql-5.1.56.tar.gz
    if [ ! -f /Workspace/mysql-5.1.56.tar.gz ]
    then
    	echo mysql
    	exit 0
	fi
fi

if [ ! -f /Workspace/libevent-1.3b.tar.gz ]
then
    wget http://libsbase.googlecode.com/files/libevent-1.3b.tar.gz
    if [ ! -f /Workspace/libevent-1.3b.tar.gz ]
    then
    	echo libevent
    	exit 0
	fi
fi

if [ ! -f /Workspace/memcached-1.4.5.tar.gz ]
then
    wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
    if [ ! -f /Workspace/memcached-1.4.5.tar.gz ]
    then
    	echo memcached
    	exit 0
	fi
fi

if [ ! -f /Workspace/PDO_MYSQL-1.0.2.tgz ]
then
    wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
        if [ ! -f /Workspace/PDO_MYSQL-1.0.2.tgz ]
    then
    	echo PDO_MYSQL
    	exit 0
	fi
fi

if [ ! -f /Workspace/libmcrypt-2.5.8.tar.gz ]
then
    wget http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
        if [ ! -f /Workspace/libmcrypt-2.5.8.tar.gz ]
    then
    	echo libmcrypt
    	exit 0
	fi
fi

if [ ! -f /Workspace/mcrypt-2.6.6.tar.gz ]
then
    wget http://ncu.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.6/mcrypt-2.6.6.tar.gz
        if [ ! -f /Workspace/mcrypt-2.6.6.tar.gz ]
    then
    	echo mcrypt
    	exit 0
	fi
fi

if [ ! -f /Workspace/php-5.3.5.tar.bz2 ]
then
    wget http://cn.php.net/distributions/php-5.3.5.tar.bz2
    if [ ! -f /Workspace/php-5.3.5.tar.bz2 ]
    then
    	echo php
    	exit 0
	fi
fi

if [ ! -f /Workspace/memcache-2.2.6.tgz ]
then
    wget http://pecl.php.net/get/memcache-2.2.6.tgz
    if [ ! -f /Workspace/memcache-2.2.6.tgz ]
    then
    	echo memcache
    	exit 0
	fi
fi

if [ ! -f /Workspace/httpd-2.2.17.tar.bz2 ]
then
    wget http://mirror.bjtu.edu.cn/apache//httpd/httpd-2.2.17.tar.bz2
    if [ ! -f /Workspace/httpd-2.2.17.tar.bz2 ]
    then
    	echo httpd
    	exit 0
	fi
fi